import json

from entity.QTemplate import QTemplate
from utils.TimeUtils import timeToStr


# 将QT数据库对象转换成实体类对象

def qt_to_entity(qt):
    entity=QTemplate(qt.template_name,
                  qt.num_questions,
                  qt.questions,
                  qt.timer_duration)
    entity.set_creator_id(qt.creator_id)
    entity.set_template_uuid(qt.template_uuid)
    entity.set_created_time(timeToStr(qt.created_time))
    return entity


